<?php

namespace common\service;

/**
 * 公共的一些方法所在的位置.
 * Class CommonService
 * @package common\service
 */
class CommonService extends BaseService
{
    /**
     * 获取客户端IP地址.
     * @return string
     */
    public static function getIP()
    {
        if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
            return $_SERVER["HTTP_X_FORWARDED_FOR"];
        return isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"]:'';
    }
}